home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
PInterfaces
/
Serial.p
< prev
next >
Wrap
Text File
|
1996-05-01
|
6KB
|
170 lines
{
File: Serial.p
Contains: Asynchronous Serial Driver (.AIn/.AOut/.BIn/.BOut) Interfaces
Version: Technology: System 7.5.2
Release: Universal Interfaces 3.0d3 on Copland DR1
Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
}
{$IFC UNDEFINED UsingIncludes}
{$SETC UsingIncludes := 0}
{$ENDC}
{$IFC NOT UsingIncludes}
UNIT Serial;
INTERFACE
{$ENDC}
{$IFC UNDEFINED __SERIAL__}
{$SETC __SERIAL__ := 1}
{$I+}
{$SETC SerialIncludes := UsingIncludes}
{$SETC UsingIncludes := 1}
{$IFC UNDEFINED __TYPES__}
{$I Types.p}
{$ENDC}
{$PUSH}
{$ALIGN MAC68K}
{$LibExport+}
CONST
baud150 = 763;
baud300 = 380;
baud600 = 189;
baud1200 = 94;
baud1800 = 62;
baud2400 = 46;
baud3600 = 30;
baud4800 = 22;
baud7200 = 14;
baud9600 = 10;
baud14400 = 6;
baud19200 = 4;
baud28800 = 2;
baud38400 = 1;
baud57600 = 0;
stop10 = 16384;
stop15 = -32768;
stop20 = -16384;
noParity = 0;
oddParity = 4096;
evenParity = 12288;
data5 = 0;
data6 = 2048;
data7 = 1024;
data8 = 3072;
aData = 6; { channel A data in or out (historical) }
aCtl = 2; { channel A control (historical) }
bData = 4; { channel B data in or out (historical) }
bCtl = 0; { channel B control (historical) }
ctsEvent = 32; { flag for SerShk.errs and SerShk.evts }
breakEvent = 128; { flag for SerShk.errs and SerShk.evts }
xOffWasSent = 128; { flag for SerStaRec.xOffSent }
dtrNegated = 64; { flag for SerStaRec.xOffSent }
ainRefNum = -6; { serial port A input }
aoutRefNum = -7; { serial port A output }
binRefNum = -8; { serial port B input }
boutRefNum = -9; { serial port B output }
swOverrunErr = 1; { serial driver error masks }
breakErr = 8; { serial driver error masks }
parityErr = 16; { serial driver error masks }
hwOverrunErr = 32; { serial driver error masks }
framingErr = 64; { serial driver error masks }
kOptionClockX1CTS = 64; { option bit used with Control code 16 }
kOptionPreserveDTR = 128; { option bit used with Control code 16 }
sPortA = 0;
sPortB = 1;
TYPE
SPortSel = SInt8;
{ csCodes for serial driver Control routines }
CONST
kSERDConfiguration = 8; { program port speed, bits/char, parity, and stop bits }
kSERDInputBuffer = 9; { set buffer for chars received with no read pending }
kSERDSerHShake = 10; { equivalent to SerHShake, largely obsolete }
kSERDClearBreak = 11; { assert break signal on output }
kSERDSetBreak = 12; { negate break state on output }
kSERDBaudRate = 13; { set explicit baud rate, other settings unchanged }
kSERDHandshake = 14; { superset of 10, honors setting of fDTR }
kSERDClockMIDI = 15; { clock externally on CTS with specified multiplier }
kSERDMiscOptions = 16; { select clock source and DTR behavior on close }
kSERDAssertDTR = 17; { assert DTR output }
kSERDNegateDTR = 18; { negate DTR output }
kSERDSetPEChar = 19; { select char to replace chars with invalid parity }
kSERDSetPEAltChar = 20; { select char to replace char that replaces chars with invalid parity }
kSERDSetXOffFlag = 21; { set XOff output flow control (same as receiving XOff) }
kSERDClearXOffFlag = 22; { clear XOff output flow control (same as receiving XOn) }
kSERDSendXOn = 23; { send XOn if input flow control state is XOff }
kSERDSendXOnOut = 24; { send XOn regardless of input flow control state }
kSERDSendXOff = 25; { send XOff if input flow control state is XOn }
kSERDSendXOffOut = 26; { send XOff regardless of input flow control state }
kSERDResetChannel = 27; { reset serial I/O channel hardware }
kSERD115KBaud = 115; { set 115.2K baud data rate (some driver versions) }
kSERD230KBaud = 230; { set 230.4K baud data rate (some driver versions) }
{ csCodes for serial driver Status routines }
kSERDInputCount = 2; { return characters available (SerGetBuf) }
kSERDStatus = 8; { return characters available (SerStatus) }
kSERDVersion = 9; { return version number in first byte of csParam }
TYPE
SerShkPtr = ^SerShk;
SerShk = PACKED RECORD
fXOn: Byte; { XOn flow control enabled flag }
fCTS: Byte; { CTS flow control enabled flag }
xOn: UInt8; { XOn character }
xOff: UInt8; { XOff character }
errs: Byte; { errors mask bits }
evts: Byte; { event enable mask bits }
fInX: Byte; { Input flow control enabled flag }
fDTR: Byte; { DTR input flow control flag }
END;
SerStaRecPtr = ^SerStaRec;
SerStaRec = PACKED RECORD
cumErrs: Byte; { errors accumulated since last SerStatus() call }
xOffSent: Byte; { input (requested to be) held off by xOffWasSent or dtrNegated }
rdPend: Byte; { incomplete read pending in I/O queue }
wrPend: Byte; { incomplete write pending in I/O queue }
ctsHold: Byte; { transmit disabled by hardware handshaking }
xOffHold: Byte; { transmit disabled by XOn/XOff handshaking }
END;
{$IFC FOR_SYSTEM7_ONLY }
FUNCTION SerReset(refNum: INTEGER; serConfig: INTEGER): OSErr;
FUNCTION SerSetBuf(refNum: INTEGER; serBPtr: Ptr; serBLen: INTEGER): OSErr;
FUNCTION SerHShake(refNum: INTEGER; {CONST}VAR flags: SerShk): OSErr;
FUNCTION SerSetBrk(refNum: INTEGER): OSErr;
FUNCTION SerClrBrk(refNum: INTEGER): OSErr;
FUNCTION SerGetBuf(refNum: INTEGER; VAR count: LONGINT): OSErr;
FUNCTION SerStatus(refNum: INTEGER; VAR serSta: SerStaRec): OSErr;
{$ENDC}
{$ALIGN RESET}
{$POP}
{$SETC UsingIncludes := SerialIncludes}
{$ENDC} {__SERIAL__}
{$IFC NOT UsingIncludes}
END.
{$ENDC}